<template>
  <div class="risk-compliance c-shadow">
    <jTabNav :items="tabList"></jTabNav>
    <div class="zhuzuo clearFix">
        <h4 class="detail-base-title d_jump" ref="inProperty5">著作权<span>{{total4 || 0}}</span></h4>
        <j-no-data v-if="hbData.length === 0" :mode="'b'" msg="b"></j-no-data>
        <div class="table-wrap" v-else>
          <table>
            <thead>
              <tr>
                <th v-for="title in environmental" :key="title">{{title}}</th>
              </tr>
            </thead>
            <tbody>
              <tr v-for="item in hbData" :key="item.writ">
                <td>{{item.name || '--'}}</td>
                <td>{{item.registerNo || '--'}}</td>
                <td>{{item.registerType || '--'}}</td>
                <td>{{item.registerDate || '--'}}</td>
              </tr>
            </tbody>
          </table>
          <div class="paging-wrap fr">
          <el-pagination v-if="total4>5"
          @size-change="handleSizeChange"
            @current-change="handleCurrentChange4"
            :current-page.sync="pageNum4"
            :page-size.sync="pageSize4"
            layout="prev, pager, next, jumper"
            :total.sync="total4">
          </el-pagination>
        </div>
        </div>
    </div>
    <div class="rjzzq">
      <h4 class="detail-base-title d_jump" ref="inProperty1">软件著作权<span>{{total || 0}}</span></h4>
      <j-no-data v-if="writData.length === 0" :mode="'b'" msg="b"></j-no-data>
      <div class="table-wrap" v-else>
        <table>
          <thead>
            <tr>
              <th v-for="title in writ" :key="title">{{title}}</th>
            </tr>
          </thead>
          <tbody>
            <tr v-for="(item,index) in writData" :key="index">
                <td>{{index + 1}}</td>
                <td>{{item.name || '--'}}</td>
                <td>{{item.registerNo || '--'}}</td>
                <td>{{item.categoryNo || '--'}}</td>
                <td>{{item.version || '--'}}</td>
                <td>{{item.firstPubTime || '--'}}</td>
            </tr>
          </tbody>
        </table>
        <div class="block paging-wrap fr">
        <el-pagination v-if="total>5"
          @size-change="handleSizeChange"
          @current-change="handleCurrentChange"
          :current-page.sync="pageNum"
          :page-size="pageSize"
          layout="prev, pager, next, jumper"
          :total="total">
        </el-pagination>
      </div>
      </div>
    </div>
    <div class="zhuanli clearFix">
        <h4 class="detail-base-title d_jump" ref="inProperty2">专利<span>{{total3 || 0}}</span></h4>
        <j-no-data v-if="courtData.length === 0" :mode="'b'" msg="b"></j-no-data>
        <div class="table-wrap" v-else>
          <table class="moremess">
            <thead>
              <tr>
                <th v-for="title in executor" :key="title">{{title}}</th>
              </tr>
            </thead>
            <tbody>
              <tr v-for="item in courtData" :key="item.writ">
                <td>{{item.appNumber || '--'}}</td>
                <td>{{item.pattypeName || '--'}}</td>
                <td>{{item.lprs || '--'}}</td>
                <td>{{item.pubDate || '--'}}</td>
                <td>{{item.abs || '--'}}</td>
              </tr>
            </tbody>
          </table>
          <div class="block paging-wrap fr">
          <el-pagination v-if="total3>5"
            @size-change="handleSizeChange"
            @current-change="handleCurrentChange3"
            :current-page.sync="pageNum3"
            :page-size="pageSize3"
            layout="prev, pager, next, jumper"
            :total="total3">
          </el-pagination>
        </div>
        </div>
        
    </div>
    <div class="shangbiao clearFix">
        <h4 class="detail-base-title d_jump" ref="inProperty3">商标<span>{{total1 || 0}}</span></h4>
        <j-no-data v-if="sxData.length === 0" :mode="'b'" msg="b"></j-no-data>
        <div class="table-wrap" v-else>
          <table>
            <thead>
              <tr>
                <th v-for="title in brand" :key="title">{{title}}</th>
              </tr>
            </thead>
            <tbody>
              <tr v-for="item in sxData" :key="item.writ">
                <td>{{item.registationNum || '--'}}</td>
                <td>{{item.name || '--'}}</td>
                <td>{{item.categoryName || '--'}}</td>
                <td>{{item.regPubTime || '--'}}</td>
              </tr>
            </tbody>
          </table>
          <div class="paging-wrap feature_wrap fr" v-if="total1>5">
          <el-pagination v-if="total1>5"
          @size-change="handleSizeChange"
            @current-change="handleCurrentChange1"
            :current-page.sync="pageNum1"
            :page-size.sync="pageSize1"
            layout="prev, pager, next, jumper"
            :total.sync="total1">
          </el-pagination>
        </div>
        </div>   
    </div>
    <div class="beian clearFix">
        <h4 class="detail-base-title d_jump" ref="inProperty4">ICP备案<span>{{total2 || 0}}</span></h4>
        <j-no-data v-if="swData.length === 0" :mode="'b'" msg="b"></j-no-data>
        <div class="table-wrap" v-else>
          <table>
            <thead>
              <tr>
                <th v-for="title in tax" :key="title">{{title}}</th>
              </tr>
            </thead>
            <tbody>
              <tr v-for="(item,index) in swData" :key="index">
                <td>{{index + 1}}</td>
                <td>
                  <a :href="'http://'+item.siteUrl" target="_blank" v-if="item.siteUrl">{{item.siteUrl || '--'}}</a>
                  <span v-else>--</span>
                  </td>
                <td>{{item.wzmc || '--'}}</td>
                <td>{{item.wzBaxh || '--'}}</td>
                <td>{{item.shsj | dateFormat}}</td>
              </tr>
            </tbody>
          </table>
          <div class="paging-wrap fr">
          <el-pagination v-if="total2>5"
          @size-change="handleSizeChange"
            @current-change="handleCurrentChange2"
            :current-page.sync="pageNum2"
            :page-size.sync="pageSize2"
            layout="prev, pager, next, jumper"
            :total.sync="total2">
          </el-pagination>
        </div>
        </div>
    </div>
  </div>
</template>
<script>
import { jTabNav, jNoData } from '../../components'
import { sysSetting as api } from '../../api'
export default {
  data() {
    return {
      tabList: [],
      sb: 0,
      ba: 0,
      zl: 0,
      zzq: 0,
      rjzzq: 0,
      writ: ['序号', '名称', '登记号', '分类号', '版本号', '登记批准日期'],
      writData: [
      ],
      executor: ['申请专利号', '专利类型', '专利状态', '公开（公告）日', '摘要'],
      courtData: [],
      brand: ['注册文字', '商标文字', '分类', '注册公示日期'],
      brandData: [],
      tax: [
        '序号',
        '网址',
        '网站名称',
        '网站部备案号',
        '审核时间'
      ],
      swData: [],
      environmental: [
        '名称',
        '登记号',
        '登记类别',
        '登记日期'
      ],
      hbData: [],
      sxData: [
      ],
      params: {},
      pageNum: 1,
      pageSize: 5,
      total: 0,
      pageNum1: 1,
      pageSize1: 5,
      total1: 0,
      pageNum2: 1,
      pageSize2: 5,
      total2: 0,
      pageNum3: 1,
      pageSize3: 5,
      total3: 0,
      pageNum4: 1,
      pageSize4: 5,
      total4: 0,
      number: '',
      entId: ''
    }
  },
  mounted() {
    this.params.entName = this.$route.query.entname
    this.getRealTimeDataEntSoftwareCopyright() // 软件著作权
    this.getExecutorInfoList() // 专利  全
    this.getBreakFaithList() // 商标
    this.getEntIcpRecord() // 备案   分页
    this.getRealTimeDataSoftwareCopyright() // 著作权
  },
  methods: {
    // 获取软件著作权
    getRealTimeDataEntSoftwareCopyright() {
      let _this = this
      let params = {
        pageNum: _this.pageNum,
        pageSize: _this.pageSize
      }
      api
        .getRealTimeDataEntSoftwareCopyright({ ..._this.params, ...params })
        .then(rtn => {
          if (!_this.rjzzq) {
            this.tabList.push({
              idx: 2,
              name: '软件著作权',
              num: rtn.data.total || 0,
              offsetTop: this.$refs['inProperty1'] ? this.$refs['inProperty1'].offsetTop : 0
            })
          }
          _this.rjzzq++
          if (!rtn.data) return false
          _this.writData = rtn.data.list
          _this.total = rtn.data.total
        })
        .catch(err => {
          _this.pageState = err
          if (!_this.rjzzq) {
            this.tabList.push({
              idx: 2,
              name: '软件著作权',
              num: 0,
              offsetTop: this.$refs['inProperty1'] ? this.$refs['inProperty1'].offsetTop : 0
            })
          }
          _this.rjzzq++
        })
    },
    handleSizeChange() {
      // 当pagesize改变的时候出发该函数
    },
    handleCurrentChange(index) {
      this.pageNum = index
      this.getRealTimeDataEntSoftwareCopyright()
    },
    // 获取专利
    getExecutorInfoList() {
      let _this = this
      let params = {
        pageNum: _this.pageNum3,
        pageSize: _this.pageSize3
      }
      api
        .getFindPatentInformation({ ..._this.params, ...params })
        .then(rtn => {
          if (!this.zl) {
            this.tabList.push({
              idx: 3,
              name: '专利',
              num: rtn.data.total || 0,
              offsetTop: this.$refs['inProperty2'] ? this.$refs['inProperty2'].offsetTop : 0
            })
          }
          ++this.zl
          if (!rtn.data) return false
          _this.courtData = rtn.data.list
          _this.total3 = rtn.data.total
        })
        .catch(err => {
          _this.pageState = err
          if (!this.zl) {
            this.tabList.push({
              idx: 3,
              name: '专利',
              num: 0,
              offsetTop: this.$refs['inProperty2'] ? this.$refs['inProperty2'].offsetTop : 0
            })
          }
          ++this.zl
        })
    },
    handleCurrentChange3(index) {
      this.pageNum3 = index
      this.getExecutorInfoList()
    },
    // 获取商标
    getBreakFaithList() {
      let _this = this
      let params = {
        pageNum: _this.pageNum1,
        pageSize: _this.pageSize1
      }
      api
        .getFindEntTraInfo({ ..._this.params, ...params })
        .then(rtn => {
          if (!this.sb) {
            this.tabList.push({
              idx: 4,
              name: '商标',
              num: rtn.data.total || 0,
              offsetTop: this.$refs['inProperty3'] ? this.$refs['inProperty3'].offsetTop : 0
            })
          }
          ++this.sb
          if (!rtn.data) return false
          _this.sxData = rtn.data.list
          _this.total1 = rtn.data.total
        })
        .catch(err => {
          _this.pageState = err
          if (!this.sb) {
            this.tabList.push({
              idx: 4,
              name: '商标',
              num: 0,
              offsetTop: this.$refs['inProperty3'] ? this.$refs['inProperty3'].offsetTop : 0
            })
          }
          ++this.sb
        })
    },
    handleCurrentChange1(index) {
      this.pageNum1 = index
      this.getBreakFaithList()
    },
    // 获取备案
    getEntIcpRecord() {
      let _this = this
      let params = {
        pageNum: _this.pageNum2,
        pageSize: _this.pageSize2
      }
      api
        .getEntIcpRecord({ ..._this.params, ...params })
        .then(rtn => {
          if (!this.ba) {
            this.tabList.push({
              idx: 5,
              name: 'ICP备案',
              num: rtn.data.size || 0,
              offsetTop: this.$refs['inProperty4'] ? this.$refs['inProperty4'].offsetTop : 0
            })
          }
          ++this.ba
          if (!rtn.data) return false
          _this.swData = rtn.data.list
          _this.total2 = rtn.data.size
        })
        .catch(err => {
          _this.pageState = err
          if (!this.ba) {
            this.tabList.push({
              idx: 5,
              name: 'ICP备案',
              num: 0,
              offsetTop: this.$refs['inProperty4'] ? this.$refs['inProperty4'].offsetTop : 0
            })
          }
          ++this.ba
        })
    },
    handleCurrentChange2(index) {
      this.pageNum2 = index
      this.getEntIcpRecord()
    },
    // 获取著作权
    getRealTimeDataSoftwareCopyright() {
      let _this = this
      let params = {
        pageNum: _this.pageNum4,
        pageSize: _this.pageSize4
      }
      api
        .getRealTimeDataSoftwareCopyright({ ..._this.params, ...params })
        .then(rtn => {
          if (!_this.zzq) {
            this.tabList.push({
              idx: 1,
              name: '著作权',
              num: rtn.data.total || 0,
              offsetTop: this.$refs['inProperty5'] ? this.$refs['inProperty5'].offsetTop : 0
            })
          }
          _this.zzq++
          if (!rtn.data) return false
          _this.hbData = rtn.data.list
          _this.total4 = rtn.data.total
        })
        .catch(err => {
          _this.pageState = err
          if (!_this.zzq) {
            this.tabList.push({
              idx: 1,
              name: '著作权',
              num: 0,
              offsetTop: this.$refs['inProperty5'] ? this.$refs['inProperty5'].offsetTop : 0
            })
          }
          _this.zzq++
        })
    },
    handleCurrentChange4(index) {
      this.pageNum4 = index
      this.getRealTimeDataSoftwareCopyright()
    }
  },
  components: {
    jNoData,
    jTabNav
  }
}
</script>
<style lang="scss" scoped>
.risk-compliance {
  padding: 28px 40px;
  font-size: 14px;
  .detail-base-title {
    line-height: 30px;
    font-size: 16px;
    font-weight: bold;
    padding: 30px 0 0 12px;
    position: relative;
    background-image: linear-gradient(0deg,#1891ef,#1891ef);
    background-size: 3px 16px;
    background-position: 0 37px;
    background-repeat: no-repeat;
    border-bottom: 1px solid #eee;
  }
  h4.detail-base-title span {
    border: 1px solid #9dc5fd;
    border-radius: 10px;
    color: #1688f3;
    background: #f2f7ff;
    font-size: 12px;
    padding: 0 10px;
    margin-left: 15px;
    vertical-align: top;
  }
  .table-wrap {
    padding: 30px 20px;
    table {
      border-collapse: collapse;
      width: 100%;
      text-align: center;
      tr:hover {
        background: #f3f8ff;
      }
      td,
      th {
        border: 1px solid #e2e2e2;
        line-height: 40px;
      }
      th {
        line-height: 38px;
        color: #999;
        background: #f2f1f1;
      }
      &.moremess {
        th:nth-child(1) {
          width: 150px;
        }
        th:nth-child(2),
        th:nth-child(3),
        th:nth-child(4) {
          width: 120px;
        }
        td:last-child {
          line-height: 20px;
          padding: 5px;
        }
      }
    }
  }
}
</style>



// WEBPACK FOOTER //
// src/view/clib/inProperty.vue